#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\res\installer.ico
#AutoIt3Wrapper_Outfile=out\plugin-installer.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=putty
#AutoIt3Wrapper_Res_Fileversion=0.1.0.0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.16.1
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------
#include <File.au3>

#include <FileConstants.au3>
#include <StringConstants.au3>

;ConsoleWrite (@ScriptDir &"\command.txt"& @CRLF)
;ConsoleWrite (@ProgramFilesDir &"\command.txt"& @CRLF)
FileMove("command.txt", @AppDataDir & "\PuTTY\command.txt", $FC_OVERWRITE + $FC_CREATEPATH)
FileMove("putty2.ini" , @AppDataDir & "\PuTTY\putty2.ini" , $FC_OVERWRITE + $FC_CREATEPATH)
FileMove("putty2.exe" , @ProgramFilesDir & "\PuTTY\putty2.exe", $FC_OVERWRITE + $FC_CREATEPATH)
FileMove("putty.exe"  , @ProgramFilesDir & "\PuTTY\putty.exe" , $FC_NOOVERWRITE + $FC_CREATEPATH)

$sFilePath = @AppDataDir & "\Bastion\tool.ini"
;$aTxt = FileReadLine ( $sFilePath , 2 )
;ConsoleWrite ($sFilePath & @CRLF)
;ConsoleWrite ($aTxt & @CRLF)
;_FileWriteToLine($sFilePath, 3, "Line 3: THIS HAS BEEN REPLACED", True)

Local $sFind = "putty.exe"
Local $sReplace = "putty2.exe"
Local $sFileName = $sFilePath
Local $iRetval = _ReplaceStringInFile($sFileName, $sFind, $sReplace, $STR_CASESENSE)
ShellExecute(@ProgramFilesDir & "\PuTTY")
ShellExecute(@AppDataDir & "\PuTTY")








